<template>
    <div>
      <h1 style="margin-left: 30px">搜索结果</h1>
      <div class="block">
        <div style="margin-right: 20px;padding-bottom: 20px">
          <el-timeline>
                <el-card>
                  <div v-for="item in results"  style="display: flex;justify-content: space-between" :key="item"  @click="skip(item.id)">
                  <div>
                  <h4>{{item.title}}</h4>
                  <p>{{item.description}}</p>
                  </div>
                  <div>
                    <img style="width: 200px;height: 110px" :src="item.coverUrl"/>
                  </div>
                  </div>
                </el-card>
          </el-timeline>
        </div>
      </div>
    </div>
</template>

<script>
  import {seekAll} from '../api/axiosRequest'
    export default {
        name: "",
      data(){
        return{
          results:[],
        }
      },
      mounted() {
          console.log("==========================");
          console.log(this.$route.params.seek);
          this.searchResult(this.$route.params.seek);
      },
      methods:{
        searchResult(params){
          seekAll("/blog/seekAll/"+params).then(res =>{
            console.log(res)
            this.results = res.data.data;
          })
        },
        skip(index){
          const _this = this;
          _this.$router.push(`/Details/${index}`)
        }
      }
    }
</script>

<style scoped>

</style>
